package com.qn.validation.annotation;

import com.qn.common.core.IntArrayValuable;
import com.qn.validation.helper.InEnumIntCollectionValidator;
import com.qn.validation.helper.InEnumIntValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * 枚举数值校验注解
 *
 * @author QN
 * @date 2024/12/31
 */
@Documented
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(
        validatedBy = {InEnumIntValidator.class, InEnumIntCollectionValidator.class}
)
public @interface InEnumInt {

    /**
     * 实现 EnumValuable 接口的枚举类
     *
     * @return 枚举类
     */
    Class<? extends IntArrayValuable> value();

    String message() default "必须在指定范围 {value}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
